
import static org.junit.Assert.*;

import org.junit.Before;

import org.junit.Test;


public class CalculatorBrainsTest {
	
	 CalculatorBrains brain = new CalculatorBrains();


	@Before
	public void setUp() throws Exception {
		brain.reset();
		assertEquals(0, brain.result(), 0);
	}



	@Test
	 public  void testPlus() {
		  
		   brain.plus(5);
		   assertEquals(5, brain.result(), 0.1);
		   brain.plus(3);
		   assertEquals(8,brain.result(), 0.1);
		   brain.reset();
		   assertEquals(0, brain.result(), 0.1);
		   
	}

	@Test
	public void testMinus() {
		brain.plus(4);
		assertEquals(4, brain.result(), 0.1);
		brain.minus(2);
		assertEquals(2, brain.result(), 0.1);
		brain.reset();
		assertEquals(0, brain.result(), 0.1);
		
	}

	@Test
	public void testDivide() {
		brain.plus(2);
		assertEquals(2, brain.result(), 0);
		brain.multiply(2);
		assertEquals(4, brain.result(), 0);
		brain.reset();
		assertEquals(0, brain.result(), 0);
		
	}

	@Test
	public void testMultiply() {
		brain.plus(2);
		assertEquals(2, brain.result(), 0);
		brain.multiply(2);
		assertEquals(4, brain.result(), 0);
		brain.reset();
		assertEquals(0, brain.result(), 0);
		
	}
}
